from django.db import models
from django.contrib.auth.models import AbstractUser


class User(AbstractUser):

    class Meta:
        db_table = 'user'
        verbose_name = '用户表'

class UserLike(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='following', verbose_name='关注者')  # 关注者
    target_user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='followers', verbose_name='被关注者')  # 被关注者
    created_time = models.DateTimeField(auto_now_add=True)
    status = models.BooleanField(default=True, verbose_name='已关注')  # True代表关注，False代表未关注

    class Meta:
        db_table = 'user_like'
        verbose_name = '粉丝关注表'
        unique_together = ('user', 'target_user')

# class Book(models.Model):
#     """书籍表"""
#     user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='whose_book', verbose_name='作者')
#     book_name = models.CharField(max_length=100, verbose_name='书名')
#     book_type = models.CharField(max_length=100, verbose_name='类型')
#
#     class Meta:
#         db_table = 'book'
#         verbose_name = '书籍表'


